package com.qili.service.base.impl;

import com.qili.base.mapper.BaseMapper;
import com.qili.base.service.impl.BaseServiceImpl;
import com.qili.entity.supervisor.SupervisorProjectMilepost;
import com.qili.entity.supervisor.SupervisorProjectStage;
import com.qili.entity.supervisor.dto.SupervisorProjectMilepostDTO;
import com.qili.mapper.supervisor.SupervisorProjectMilepostMapper;
import com.qili.service.base.SupervisorProjectMilepostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author zhaoyongke
 * @date 2020/11/3
 * @description
 */
@Service
public class SupervisorProjectMilepostServiceImpl  extends BaseServiceImpl<SupervisorProjectMilepost,String> implements SupervisorProjectMilepostService {

    @Autowired
    private SupervisorProjectMilepostMapper supervisorProjectMilepostMapper;
    @Override
    public BaseMapper<SupervisorProjectMilepost, String> getMappser() {
        return supervisorProjectMilepostMapper;
    }

    @Override
    public List<SupervisorProjectMilepostDTO> selectProjectmilepost(SupervisorProjectMilepostDTO dto) {
        List<SupervisorProjectMilepostDTO>  list=  supervisorProjectMilepostMapper.selectProjectmilepost(dto);
        return  list;
    }

    @Override
    public List<SupervisorProjectMilepost> getFinishedMilepost(SupervisorProjectMilepost milepost) {
        Example example = new Example(SupervisorProjectMilepost.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("ProjectId",milepost.getProjectId());
        criteria.andEqualTo("supervisorProjectStageId",milepost.getSupervisorProjectStageId());
        criteria.andEqualTo("finishStatus","2");
        Example.Criteria criteria1 = example.createCriteria();
        criteria1.orEqualTo("id",milepost.getId());
        example.or(criteria1);
        return supervisorProjectMilepostMapper.selectByExample(example);
    }

    @Override
    public int deleteByProjectIds(String[] ids) {
        return supervisorProjectMilepostMapper.deleteByProjectIds(ids);
    }

    @Override
    public String getFinishedMilepostProgress(SupervisorProjectStage stage) {
        return supervisorProjectMilepostMapper.getFinishedMilepostProgress(stage);
    }

    @Override
    public String getFinishedMilepostProgress(SupervisorProjectMilepost milepost) {
        return supervisorProjectMilepostMapper.getFinishedMilepostProgressWith(milepost);
    }
/*    @Override
    public int insert(SupervisorProjectMilepost supervisorProjectMilepost) {

        return supervisorProjectMilepostMapper.insert(supervisorProjectMilepost);
    }*/

    @Override
   public  List<SupervisorProjectMilepostDTO> selectMilePostOrder(SupervisorProjectMilepostDTO dto){
        List<SupervisorProjectMilepostDTO>  listMipost=supervisorProjectMilepostMapper.selectMilePostOrder(dto);
        return listMipost;

    }
}
